package com.framework.modules.base.dao;

import com.framework.modules.base.entity.UserBalanceEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * 用户余额表
 * 
 * @author MIT
 * @email litmiss@gmail.com
 * @date 2020-10-03 16:58:29
 */
public interface UserBalanceDao extends BaseMapper<UserBalanceEntity> {

    /**
     * 增加余额
     * @param uid
     * @param amount
     * @return
     */
    @Update("update tb_user_balance set balance=balance+#{amount} where uid=#{uid}")
    Integer addBalance(@Param("uid") Integer uid, @Param("amount") BigDecimal amount);


    /**
     * 增加金币
     * @param uid
     * @param coin 金币
     * @return
     */
    @Update("update tb_user_balance set coin=coin+#{coin} where uid=#{uid}")
    Integer addCoin(@Param("uid")Integer uid,@Param("coin")Integer coin);
}
